<?php

$params = require(__DIR__ . '/params.php');

return [
    'id' => 'app-wechat',
    'defaultRoute' => "api/main/doc",
    'basePath' => dirname(dirname(__DIR__)),
    'viewPath'=>'@res/api/views',
    'bootstrap' => ['log'],
    'controllerNamespace' => 'app\api\controllers',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'cookieValidationKey' => 'yangliqiang',
            'enableCsrfValidation' => false,
        ],
        'session' => [
            'name' => 'advanced-frontend',
        ],
        'log' => [
            'traceLevel' =>  YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    //'categories' => ['yii\*'],
                    'logFile'=>'@runtime/log/'.date('Ymd',time()).'/'.date('H.i',time()).'.log'

                ],
                [
                    'class' => 'yii\log\EmailTarget',
                    'levels' => ['error'],
                    'message' => [
                        'from' => ['wechat@example.com'],
                        'to' => ['953933980@qq.com', 'ylqlovecl@163.com'],
                        'subject' => '微信第三方平台错误日志',
                    ],
                ]
            ],
        ],
//        'errorHandler' => [
//            'errorAction' => 'admin/main/404',
//            'maxSourceLines' => 20,
//        ],
        'urlManager' => require_once __DIR__ . '/route.php',
        "db" => require(__DIR__ . '/db.php'),
        'cache'=>[
            'class'=>'yii\caching\FileCache',
            'cachePath'=>'@runtime/cache'
        ],
        //这个选项就是设置assets相关的默认值
        'assetManager'=>[
            // 设置存放assets的文件目录位置
            'basePath'=>'@app/web/assets',
            // 设置访问assets目录的url地址
            'baseUrl'=>'/web/assets',
        ]
    ],
    'modules' => [
        'api' => [
            'class' => 'app\api\Module',
            'basePath'=>'@app/api',
            'viewPath'=>'@res/api/views',
            'defaultRoute'=>'main/doc'
        ],

    ],
    'params' => $params,
];
